import { test, expect } from '@playwright/test'

test('多选配置项', async ({ page }) => {
  page.on('pageerror', (exception) => expect(exception).toBeNull())
  await page.goto('grid-operation-column#operation-column-selection-config')
  const demo = page.locator('#operation-column-selection-config')
  await expect(demo.locator('.tiny-grid-body__row').nth(0).locator('input')).toBeChecked()
  await expect(demo.locator('.tiny-grid-body__row').nth(1).locator('input')).toBeDisabled()
  await expect(demo.locator('.tiny-grid-body__row').nth(3).locator('input')).toBeDisabled()
  await demo.locator('.tiny-grid-header__row').locator('.tiny-grid-checkbox').first().click()
  await expect(demo.locator('.tiny-grid-body__row').nth(0).locator('input')).toBeChecked()
  await expect(demo.locator('.tiny-grid-body__row').nth(2).locator('input')).toBeChecked()
  await expect(demo.locator('.tiny-grid-body__row').nth(4).locator('input')).toBeChecked()
  await expect(demo.locator('.tiny-grid-body__row').nth(6).locator('input')).toBeChecked()
  await demo.locator('.tiny-grid-header__row').locator('.tiny-grid-checkbox').first().click()
  await expect(demo.locator('.tiny-grid-body__row').nth(0).locator('input')).not.toBeChecked()
  await expect(demo.locator('.tiny-grid-body__row').nth(2).locator('input')).not.toBeChecked()
  await expect(demo.locator('.tiny-grid-body__row').nth(4).locator('input')).not.toBeChecked()
  await expect(demo.locator('.tiny-grid-body__row').nth(6).locator('input')).not.toBeChecked()
})
